package fun.liuyu2783.txmessage.marketing.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import fun.liuyu2783.txmessage.common.Response;
import fun.liuyu2783.txmessage.marketing.dao.CouponMapper;
import fun.liuyu2783.txmessage.marketing.dto.Coupon;
import fun.liuyu2783.txmessage.marketing.service.CouponService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liuyu2783
 * @since 2021-11-23
 */
@Service
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService {

    @Override
    @Transactional(rollbackFor = {Exception.class})
    public Response add(String tradeId) {
        Coupon coupon = new Coupon();
        coupon.setId("1");
        coupon.setTradeId(tradeId);
        int insert = this.baseMapper.insert(coupon);
        return Response.success(insert);
    }
}
